<%@ page import="sige.Turma" %>

<div class="control-group" >
    <label  class="control-label" for="ano">
		<g:message code="turma.ano.label" default="Ano Letivo" />
		<span class="required-indicator">*</span>
    </label>
    <div class="controls" >
	    <g:select id="ano" name="ano.id" from="${sige.AnoLetivo.abertos()}" 
	        optionKey="id" required="" value="${turmaInstance?.ano?.id}" />
    </div>
</div>

<div class="control-group" >
    <label  class="control-label" for="serie">
		<g:message code="turma.serie.label" default="Serie" />
		<span class="required-indicator">*</span>
    </label>
    <div class="controls" >
	    <g:select id="serie" name="serie.id" from="${sige.Serie.list()}" 
	        optionKey="id" required="" value="${turmaInstance?.serie?.id}" />
    </div>
</div>

<div class="control-group" >
    <label  class="control-label" for="turno">
		<g:message code="turma.turno.label" default="Turno" />
		<span class="required-indicator">*</span>
    </label>
    <div class="controls" >
	    <g:select id="turno" name="turno" from="${turmaInstance?.constraints.turno.inList}" 
	        required="" value="${turmaInstance?.turno}" />
    </div>
</div>

<div class="control-group" >
    <label  class="control-label" for="nome">
		<g:message code="turma.nome.label" default="Nome" />
    </label>
    <div class="controls" >
	    <g:textField name="nome" value="${turmaInstance?.nome}"/>
    </div>
</div>

<g:if test="${turmaInstance?.id}">
<div class="control-group" >
    <label  class="control-label" for="contratos">
		<g:message code="turma.contratos.label" default="Contratos" />
		
    </label>
    <div class="controls" >

        <ul class="one-to-many">
            <g:each in="${turmaInstance?.contratos?}" var="c">
                <li><g:link controller="contrato" action="show" id="${c.id}">${c?.encodeAsHTML()}</g:link></li>
            </g:each>
            <li class="add">
                <g:link controller="contrato" action="create" params="['turma.id': turmaInstance?.id]">
                    ${message(code: 'default.add.label', args: [message(code: 'contrato.label', default: 'Contrato')])}
                </g:link>
            </li>
        </ul>

    </div>
</div>
</g:if>
